<template>
	<view id="letter">
		<mescroll-uni ref="mescrollRef" @init="mescrollInit" top="0" bottom="0" @down="downCallback" @up="upCallback">
			<view class="noticeList" v-for="(item,index) in list" :key="index" @click='goDetails(item.id)'>
				<view class="content">
					<text class="point" v-if="!isSee"></text>
					<text class="html">{{item.title}}</text>
				</view>
				<view class="time">{{item.create_time}}</view>
			</view>
		</mescroll-uni>
	</view>
</template>
<script>
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"
	export default {
		mixins: [MescrollMixin],
		data() {
			return {
				list:[]
			}
		},
		methods: {
			upCallback(page) {
				this.httpClient.post('agents/app/notice/getList', {
					pageNum:page.num,
					pageSize:page.size,
					group:1
				}).then(res => {
					this.mescroll.endByPage(res.rows.length, res.total);
					//this.mescroll.endSuccess(res.data.length);
					if (page.num == 1) this.list = [];
					this.list = this.list.concat(res.rows);
				}).catch(() => {
					this.mescroll.endErr();
				})
			},
			goDetails(id){
				uni.navigateTo({
					url:'letterDetail?id='+id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	#letter{
		.noticeList{
			padding: 15rpx 30rpx;
			width: 100%;
			box-sizing: border-box;
			background: #fff;
			margin-bottom: 1rpx;
			.content{
				.point{
					display: inline-block;
					width: 0.5rem;
					height: 0.5rem;
					border-radius: 50%;
					background: #f00;
					margin-right: 5px;
				}
				.html{
					display: inline-block;
				}
			}
			.time{
				color: #888;font-size:32rpx;
			}
		}
	}
</style>
